// ******************************************************************
// * Copyright(c)  Steven Lu
// * Description   : Entity_MST_INDUSTRY_TYPE
// * CreateDate    : 2011/8/16 10:16:40
// * Creater       : CodeSmith
// * LastChangeDate: 2011/8/16 10:16:40
// * LastChanger   : 2011/8/16 10:16:40
// * Version Info  : 1.0 For ESOL
// ******************************************************************

using System;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Suzsoft.Smart.Data;
using ESOL.Common.Entity;
using ESOL.Common;

namespace ESOL.Business.Mst
{
/// <summary>
    /// MstIndustryType
    /// </summary>
    public partial class MstIndustryTypeBs
    {
        #region GetByID
        /// <summary>
        /// Get Entity
        /// </summary>
        /// <param name="objMstIndustryTypeEntity">Entity</param>
        /// <returns>Entity</returns>
        public static MstIndustryTypeEntity GetMstIndustryType(MstIndustryTypeEntity objMstIndustryTypeEntity)
        {
            return DataAccess.SelectSingle<MstIndustryTypeEntity>(objMstIndustryTypeEntity);
        }
        public static List<MstIndustryTypeEntity> GetAllIndustryTypeList()
        {
            return DataAccess.SelectAll<MstIndustryTypeEntity>();
        }
        public static DataTable GetIndustryTypeByCondition(string condition, string orderBy, string rowCount)
        {
            string sql = CommonFunctions.GetSelect(rowCount) + @"D.* 
                        FROM MST_INDUSTRY_TYPE D
                        WHERE 1=1 ";
            if (string.IsNullOrEmpty(condition) == false)
            {
                sql += condition;
            }
            if (string.IsNullOrEmpty(orderBy) == false)
            {
                sql += " ORDER BY " + orderBy;
            }
            DataSet ds = DataAccess.SelectDataSet(sql);
            if (ds != null && ds.Tables.Count > 0)
            {
                return ds.Tables[0];
            }
            return null;
        }
        public static DataTable GetAllIndustryType()
        {
            string sql = "SELECT * FROM MST_INDUSTRY_TYPE GROUP BY INDUSTRY_TYPE_CODE,INDUSTRY_TYPE_NAME,DESCRIPTION";
            DataSet ds = DataAccess.SelectDataSet(sql);
            if (ds != null && ds.Tables.Count > 0)
            {
                return ds.Tables[0];
            }
            return null;
        }
        public static bool CheckCodeIsExist(string sInPutCode)
        {
            string sql = "SELECT * FROM MST_INDUSTRY_TYPE where INDUSTRY_TYPE_CODE='"+sInPutCode+"'";
            DataSet ds = DataAccess.SelectDataSet(sql);
            if (ds.Tables[0].Rows.Count > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        #endregion


        #region Insert
        /// <summary>
        /// Insert Data
        /// </summary>
        /// <param name="objMstIndustryTypeEntity">Entity</param>
        /// <returns>true Insert Succeed; false Insert Fail</returns>
        public static bool InsertMstIndustryType(MstIndustryTypeEntity objMstIndustryTypeEntity)
        {
            return DataAccess.Insert(objMstIndustryTypeEntity);
        }

        public static bool InsertMstIndustryType(List<MstIndustryTypeEntity> objMstIndustryTypeEntityList)
        {
            return DataAccess.Insert(objMstIndustryTypeEntityList);
        }
        #endregion


        #region Update
        /// <summary>
        /// Update Data
        /// </summary>
        /// <param name="objMstIndustryTypeEntity">Entity</param>
        /// <returns>true Update Succeed; false Update Fail</returns>
        public static bool UpdateMstIndustryType(MstIndustryTypeEntity objMstIndustryTypeEntity)
        {
            return DataAccess.Update(objMstIndustryTypeEntity);
        }

        public static bool UpdateMstIndustryType(List<MstIndustryTypeEntity> objMstIndustryTypeEntityList)
        {
            return DataAccess.Update<MstIndustryTypeEntity>(objMstIndustryTypeEntityList);
        }
        #endregion


        #region Delete
        /// <summary>
        /// Delete Data
        /// </summary>
        /// <param name="objMstIndustryTypeEntity">Entity</param>
        /// <returns>true Delete Succeed; false Delete Fail</returns>
        public static bool DeleteMstIndustryType(MstIndustryTypeEntity objMstIndustryTypeEntity)
        {
            return DataAccess.Delete(objMstIndustryTypeEntity);
        }

        public static bool DeleteMstIndustryType(List<MstIndustryTypeEntity> objMstIndustryTypeEntityList)
        {
            return DataAccess.Delete<MstIndustryTypeEntity>(objMstIndustryTypeEntityList);
        }
        #endregion


        #region GetAll
        /// <summary>
        /// Get All Data
        /// </summary>
        /// <returns>Back All Data<returns>
        public static DataSet GetMstIndustryTypeAll()
        {
            return DataAccess.SelectAllDataSet<MstIndustryTypeEntity>();
        }
        /// <summary>
        /// Get All Data List
        /// </summary>
        /// <returns>Back All Data List<returns>
        public static List<MstIndustryTypeEntity> GetMstIndustryTypeAllList()
        {
            return DataAccess.SelectAll<MstIndustryTypeEntity>();
        }
        #endregion
	}
	
	
}	

